package com.irdstudio.efp.nls.service.common.rules.apply;

import com.irdstudio.basic.framework.core.constant.EsbRetCodeStandard;
import com.irdstudio.basic.framework.core.exception.BizException;
import com.irdstudio.efp.nls.service.common.rules.CheckRule;
import com.irdstudio.efp.nls.service.vo.NlsApplyInfoVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Objects;

/**
 * 需求编号:2019D08--
 * 问题编号:
 * 开发人员: caoxin
 * 创建日期:2019/12/4
 * 功能描述:
 * 修改日期:2019/12/4
 * 修改描述:
 */
public class ApplySeqExistRule implements CheckRule {
    private static Logger logger = LoggerFactory.getLogger(ApplySeqExistRule.class);
    private NlsApplyInfoVO nlsApplyInfoVO;

    public ApplySeqExistRule(NlsApplyInfoVO nlsApplyInfoVO) {
        this.nlsApplyInfoVO = nlsApplyInfoVO;
    }

    @Override
    public void check() throws BizException {
        if (Objects.nonNull(nlsApplyInfoVO)) {
            if (logger.isErrorEnabled()) {
                logger.error("普税贷用信通知接口 用信申请流水号:【"+nlsApplyInfoVO.getApplySeq()+"】 已经存在用信申请记录，请核查！");
            }
            throw new BizException(EsbRetCodeStandard.WFJKYWGZ.getValue(), "用信申请流水号： + 【" + nlsApplyInfoVO.getApplySeq() + "】 + ，已经存在用信申请记录，请核查！");
        }
    }
}
